<!--- <cfscript>
	scholarshipGateway = new assets.calgrants.com.gateway.ScholarshipGateway();
	if (IsUserLoggedIn()) {
		scholarship = scholarshipGateway.get(Scholarship_ID = GetAuthUser());
	} else if (IsDefined("Claim_ID") and Len(Trim(Claim_ID)) gt 0) {
		qScholarship = scholarshipGateway.query(Claim_ID = Claim_ID);
		scholarship = scholarshipGateway.get(Scholarship_ID = qScholarship.Scholarship_ID);
	}
</cfscript>

<cfif IsDefined("scholarship") and IsNumeric(scholarship.getScholarship_ID())>

	<cfscript>

		institutionGateway = new assets.calgrants.com.gateway.InstitutionGateway();
		institution = institutionGateway.get(Institution_ID = scholarship.getInstitution1_ID());
		if (institution.getInstitution_ID() gt 0 and ListFind("Semester,Quarter", institution.getTerm_Type()) gt 0) {
			paymentScheduleGateway = new assets.calgrants.com.gateway.PaymentScheduleGateway();
			paymentSchedule = paymentScheduleGateway.query(Cohort = scholarship.getCohort(), Scholarship_Type = scholarship.getScholarship_Type(), Term_Type = institution.getTerm_Type());
			paymentGateway = new assets.calgrants.com.gateway.PaymentGateway();
			payments = paymentGateway.query(Scholarship_ID = scholarship.getScholarship_ID());
		}
	</cfscript>
	
	<script type="text/javascript" language="javascript">
	<!--	
		var validate = function() {
			var errors = "";
			var valid = true;
			if (!valid) {
				alert(errors);
			}
			return valid;				
		}
		
		$(function() {
		})
	//-->
	</script>
	
	<cfif IsDefined("paymentSchedule") and paymentSchedule.RecordCount gt 0>
	
		<table id="paymentsTable" class="table table-hover table-bordered">
			<thead>
				<tr>
					<th>Term</th>
					<th>Required Documents</th>
					<th>Deadline</th>
					<th>Amount</th>
					<th>Status</th>
				</tr>
			</thead>
			<tbody>
				<cfoutput query="paymentSchedule">
					<cfquery name="GetPayment" dbtype="query">
						select *
						from payments
						where Payment_Schedule_ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#Payment_Schedule_ID#">
					</cfquery>
					<tr>
						<td>#Term#</td>
						<td>
							<cfif Verification_Type eq "Enrollment">
								Class schedule
							<cfelseif Verification_Type eq "Performance">
								Transcript
							</cfif>
						</td>
						<td>#DateFormat(Verification_Soft_Deadline, "m/d/yyyy")#</td>
						<td>#DollarFormat(Payment_Amount)#</td>
						<td>
							<cfif GetPayment.RecordCount eq 0>
								<cfif DateDiff("d", Now(), Verification_Soft_Deadline) lt 0>
									<cfif Verification_Type eq "Enrollment">
										Late, class schedule not received
									<cfelseif Verification_Type eq "Performance">
										Late, transcript not recieved
									</cfif>
								<cfelse>
									Future payment
								</cfif>
							<cfelseif GetPayment.Opt_Out eq 1>
								Disqualified or opted-out
							<cfelseif IsNumeric(GetPayment.Payment_Amount)>
								Paid on #DateFormat(GetPayment.Payment_Date, "m/d/yyyy")#
							<cfelseif IsDate(GetPayment.Payment_Submitted_Date)>
								Submitted on #DateFormat(GetPayment.Payment_Submitted_Date, "m/d/yyyy")#
							<cfelseif IsDate(GetPayment.Approval_Date)>
								Approved on #DateFormat(GetPayment.Approval_Date, "m/d/yyyy")#
							<cfelse>
								<cfif IsDate(GetPayment.Institution1_Document_Date)>
									<cfif Verification_Type eq "Enrollment">
										Class schedule received
									<cfelseif Verification_Type eq "Performance">
										Transcript recieved
									</cfif>
								<cfelseif DateDiff("d", Now(), Verification_Soft_Deadline) gt 0>
									<cfif Verification_Type eq "Enrollment">
										Late, class schedule not received
									<cfelseif Verification_Type eq "Performance">
										Late, transcript not recieved
									</cfif>
								<cfelse>
									<cfif Verification_Type eq "Enrollment">
										Class schedule not received
									<cfelseif Verification_Type eq "Performance">
										Transcript not recieved
									</cfif>
								</cfif>
							</cfif>
							<!--- <cfif paymentSchedule[p].optOut eq 1 or IsNumeric(paymentSchedule[p].paymentAmount)>
								Paid
							<cfelseif IsDate(paymentSchedule[p].approvalDate)>
								Approved
							<cfelseif 
		(paymentSchedule[p].institution1ID gt 0 and IsDate(paymentSchedule[p].institution1DocumentDate)) and 
		(paymentSchedule[p].institution2ID eq 0 OR (paymentSchedule[p].institution2ID gt 0 and IsDate(paymentSchedule[p].institution1DocumentDate))) and 
		(paymentSchedule[p].institution3ID eq 0 OR (paymentSchedule[p].institution3ID gt 0 and IsDate(paymentSchedule[p].institution3DocumentDate)))>
								<cfif paymentSchedule[p].verificationType eq "Enrollment">
									Class schedule(s) received
								<cfelseif paymentSchedule[p].verificationType eq "Performance">
									Transcripts(s) received
								</cfif>
							<cfelseif IsDate(paymentSchedule[p].verificationSoftDeadline) and DateFormat(now()) gte DateFormat(paymentSchedule[p].verificationSoftDeadline)>
								<cfif paymentSchedule[p].verificationType eq "Enrollment">
									Class schedule(s) late
								<cfelseif paymentSchedule[p].verificationType eq "Performance">
									Transcript(s) late
								</cfif>
							<cfelseif IsDate(paymentSchedule[p].verificationSoftDeadline) and DateFormat(now()) lt DateFormat(paymentSchedule[p].verificationSoftDeadline)>
								On-schedule
							</cfif> --->
						</td>						
					</tr>
				</cfoutput>
			</tbody>
		</table>
		
		<p>Please send Cash for College the required documentation by the deadline via fax or mail.</p>
		
		<table border="0" cellpadding="4" cellspacing="0">
			<tr valign="top">
				<td><strong>Fax:</strong>&nbsp;</td>
				<td>(213) 482-0814<br></td>
			</tr>
			<tr valign="top">
				<td><strong>Mail:</strong>&nbsp;<br></td>
				<td>
					Carmen Gomez<br>
					Cash for College Administrator<br>
					350 S. Bixel Street, Suite 200<br>
					Los Angeles, CA 90017<br>			
				</td>
			</tr>
		</table>
		
	<cfelse>
		<div class="alert alert-info notFound">No scheduled payments.</div>
	</cfif>
	
	<!--- <h4>Banking Information</h4>
	
	<cfif Len(Trim(scholarship.getPayment_Method())) eq 0>
	
		<p>You can have your Cash for College scholarship payment sent to you by one of two methods.</p>
		
		<ol>
			<li> Electronic Funds Transfer (EFT) deposited directly into a personal checking or savings account</li>
			<li> A check mailed directly to your college or university financial aid or scholarship office</li>
		</ol>
		
		<p>If you have a checking or savings account, EFT is the preferred method.</p>
		
		<p>Please select the method you would like to receive your scholarship payment.</p>
		
	<cfelseif scholarship.getPayment_Method() eq "EFT">
	
		<p>You will be paid by Electronic Funds Transfer (EFT).</p>
	
	<cfelseif scholarship.getPayment_Method() eq "Check">
	
	</cfif>
	
	<cfform action="#script_name#" method="post">
		<div class="text-control clearfix">
			<label class="required">Payment Method</label>
			<label class="radio inline">
				<cfif scholarship.getPayment_Method() eq "EFT" or Len(Trim(scholarship.getPayment_Method)) eq 0>
					<cfinput type="radio" name="Payment_Method" value="EFT" checked="yes"> EFT
				<cfelse>
					<cfinput type="radio" name="Payment_Method" value="EFT"> EFT
				</cfif>
			</label>
			<label class="radio inline">
				<cfif scholarship.getPayment_Method() eq "Check">
					<cfinput type="radio" name="Payment_Method" value="Check" checked="yes"> Check
				<cfelse>
					<cfinput type="radio" name="Payment_Method" value="Check"> Check
				</cfif> 
			</label>
		</div>
		<div id="eftContainer">
		
			<!--- <cfset accountLen = Len(scholarship.getAccount_Number())>
			<cfset asteriskLen = accountLen - 4> --->
		
			<table border="0" cellpadding="4" cellspacing="0" class="formTable">
				<tr>
					<th>Account Type:<br></th>
					<td>
					<cfselect name="accountType" required="yes" message="Account Type is required">
						<option value="">Select...</option>
						<option value="Checking"<cfif scholarship.getAccount_Type() eq "Checking"> selected</cfif>>Checking</option>
						<option value="Savings"<cfif scholarship.getAccount_Type() eq "Savings"> selected</cfif>>Savings</option>
					</cfselect>
					<br></td>
				</tr>
				<tr>
					<th>Bank Routing Number:<br></th>
					<td><cfinput type="Text" name="routingNumber" value="#scholarship.getRouting_Number()#" required="Yes" message="Bank Routing Number is required" maxlength="20" style="width: 200px;"><br></td>
				</tr>
				<tr>
					<th>Bank Account Number:<br></th>
					<td><cfinput type="Text" name="accountNumber" value="#scholarship.getAccount_Number()#" required="Yes" message="Bank Account Number is required" maxlength="20" style="width: 200px;"><br></td>
				</tr>
				<tr>
					<td colspan="2"><cfinput type="submit" name="submitButton" value="Submit" class="button"></td>
				</tr>
			</table>
					
			<p><strong>Find the right numbers</strong><br />
			Take a look at a sample check with the banking numbers clearly pointed out.</p>

			<ol>
				<li><strong>Find your Bank Routing Number</strong><br />
				The first 9 numbers from the left at the bottom of your check are your Bank Routing Number. This number is always 9 digits. Your Bank Routing Number is NOT a Debit or ATM card number.</li>
				<li><strong>Find your Checking Account Number</strong><br />
				You can find the Checking Account Number within the line of numbers located at the bottom of one of your checks. It is the second set of numbers, after the Bank Routing Number. Make sure you are using a check and not a deposit slip, since the numbers may not be the same. If you are using a Savings Account Number, you will not find it on your check, but on other banking documents.</li>
			</ol>
			
			<img src="/applications/scholarships/images/dd_check.jpg">
			
			<ul> 
				<li>Do NOT provide a debit card number</li> 
				<li>Do NOT provide a social security number</li>
				<li>Do NOT use the SAMPLE numbers above</li>
				<li>If you are using a savings account, look for these numbers on a deposit slip or contact your bank.
			</ul>
			
			<p>Please be careful to provide your correct information.  Incorrect information may delay your scholarship payment.</p>
		</div>
		<div id="checkContainer">
		
		</div>
	</cfform> --->

	<!--- if prior to Cohort 4 and PBS, or Cohort 4 or later, we collect payment information --->
	<!--- <cfif (scholarship.getPBS() eq 1 and scholarship.getAccount_Type() neq "Check") or scholarship.getCohort() gte 4>
	
		<br>
		
		<h2>Payment Selection</h2>
		
		<cfif scholarship.getPayment_Method() eq "Check">
		
			<p><strong>You will be paid by check.</strong></p>
			
			<p>Your Cash for College scholarship payment be sent directly to your college or university campus financial aid or scholarship office.</p>
			
			<!--- <cfform name="switchPaymentMethodForm" id="switchPaymentMethodForm"  action="#script_name#" method="post">
				<cfinput type="hidden" name="theMethod" value="switchPaymentMethod">
				<cfinput type="hidden" name="scholarshipID" value="#scholarship.getScholarship_ID()#" />
				<cfinput type="hidden" name="paymentMethod" value="EFT">
				<cfinput type="submit" name="submitButton" value="Switch to EFT" class="button2" style="width: 200px;">
			</cfform> --->
		
		<cfelse>
		
			<p><strong>You will be paid by Electronic Funds Transfer (EFT).</strong></p>
			
			<cfif NOT getBanking>
			
				<!--- <cfform name="switchPaymentMethodForm" id="switchPaymentMethodForm"  action="#script_name#" method="post">
					<cfinput type="hidden" name="theMethod" value="switchPaymentMethod">
					<cfinput type="hidden" name="scholarshipID" value="#scholarship.getScholarship_ID()#" />
					<cfinput type="hidden" name="paymentMethod" value="Check">
					<cfinput type="submit" name="submitButton" value="Switch to check" class="button2" style="width: 200px;">
				</cfform> --->
			
				<cfset accountLen = Len(scholarship.getAccount_Number())>
				<cfset asteriskLen = accountLen - 4>
			
				<p>Your scholarship payments will be deposited into your <strong>#scholarship.getAccount_Type()#</strong> account ending in <strong>#Right(scholarship.getAccount_Number(), 4)#</strong> by EFT.</p>
				
				<cfform name="editBankingInfo" action="#script_name#" method="post">
					<cfinput type="hidden" name="theInterface" value="payments">
					<cfinput type="hidden" name="getBanking" value="true">
					<cfinput type="hidden" name="scholarshipID" value="#scholarship.getScholarship_ID()#">
					<table border="0" cellpadding="4" cellspacing="0" class="formTable">
						<tr>
							<th>Account Type:<br></th>
							<td>#scholarship.getAccount_Type()#<br></td>
						</tr>
						<tr>
							<th>Bank Routing Number:<br></th>
							<td>#scholarship.getRouting_Number()#<br></td>
						</tr>
						<tr>
							<th>Bank Account Number:<br></th>
							<td><cfloop index="i" from="1" to="#asteriskLen#">*</cfloop>#Right(scholarship.getAccount_Number(), 4)#<br></td>
						</tr>
						<tr>
							<td colspan="2"><cfinput type="submit" name="submitButton" value="Edit" class="button"></td>
						</tr>
					</table>
				</cfform>
				
			<cfelse>
			
				<cfform name="bankingForm" id="bankingForm" action="#script_name#" method="post" style="margin: 0; padding: 0;" onsubmit="return validateBankingForm();">
					<cfinput type="hidden" name="theMethod" value="bankingFormSave">
					<cfinput type="hidden" name="scholarshipID" value="#scholarship.getScholarship_ID()#">
					<cfinput type="hidden" name="paymentMethod" value="#scholarship.getPayment_Method()#">
			
					<table border="0" cellpadding="4" cellspacing="0" class="formTable">
						<tr>
							<th>Account Type:<br></th>
							<td>
							<cfselect name="accountType" required="yes" message="Account Type is required">
								<option value="Checking"<cfif scholarship.getAccount_Type() eq "Checking"> selected</cfif>>Checking</option>
								<option value="Savings"<cfif scholarship.getAccount_Type() eq "Savings"> selected</cfif>>Savings</option>
							</cfselect>
							<br></td>
						</tr>
						<tr>
							<th>Bank Routing Number:<br></th>
							<td><cfinput type="Text" name="routingNumber" value="#scholarship.getRouting_Number()#" required="Yes" message="Bank Routing Number is required" maxlength="20" style="width: 200px;"><br></td>
						</tr>
						<tr>
							<th>Bank Account Number:<br></th>
							<td><cfinput type="Text" name="accountNumber" value="#scholarship.getAccount_Number()#" required="Yes" message="Bank Account Number is required" maxlength="20" style="width: 200px;"><br></td>
						</tr>
						<tr>
							<td colspan="2"><cfinput type="submit" name="submitButton" value="Submit" class="button"></td>
						</tr>
					</table>
				
				</cfform>
			
				<p><strong>Find the right numbers</strong><br />
				Take a look at a sample check with the banking numbers clearly pointed out.</p>

				<ol>
					<li><strong>Find your Bank Routing Number</strong><br />
					The first 9 numbers from the left at the bottom of your check are your Bank Routing Number. This number is always 9 digits. Your Bank Routing Number is NOT a Debit or ATM card number.</li>
					<li><strong>Find your Checking Account Number</strong><br />
					You can find the Checking Account Number within the line of numbers located at the bottom of one of your checks. It is the second set of numbers, after the Bank Routing Number. Make sure you are using a check and not a deposit slip, since the numbers may not be the same. If you are using a Savings Account Number, you will not find it on your check, but on other banking documents.</li>
				</ol>
				
				<img src="/applications/scholarships/images/dd_check.jpg">
				
				<ul> 
					<li>Do NOT provide a debit card number</li> 
					<li>Do NOT provide a social security number</li>
					<li>Do NOT use the SAMPLE numbers above</li>
					<li>If you are using a savings account, look for these numbers on a deposit slip or contact your bank.
				</ul>
				
				<p>Please be careful to provide your correct information.  Incorrect information may delay your scholarship payment.</p>
			
			</cfif> --->
			
		<!--- <cfelse>
		
			<p><strong>Please select a payment method to receive your scholarship payment.</strong></p> --->	
	<!--- <cfform name="scholarInstitutionForm" id="scholarInstitutionForm" action="#script_name#" method="post" onsubmit="return validate();">
			<cfinput type="hidden" name="action" value="saveScholar" />
			<cfif IsUserLoggedIn()>
				<cfinput type="hidden" name="view" value="#view#" />
			<cfelse>
				<cfinput type="hidden" name="view" value="editScholarBanking" />
				<cfinput type="hidden" name="Claim_ID" value="#scholarship.getClaim_ID()#" />
			</cfif>

			<div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">
						<div class="clearfix">
							<label class="required">Attendance Level</label>
							<cfselect name="Attendance_Level" required="yes" message="Attendance Level is required" onChange="validateAttendanceLevel();" class="span3">
								<option value="Full-time"<cfif scholarship.getAttendance_Level() eq "Full-time"> selected</cfif>>Full-time</option>
								<option value="Half-time"<cfif scholarship.getAttendance_Level() eq "Half-time"> selected</cfif>>Half-time</option>
								<option value="Part-time"<cfif scholarship.getAttendance_Level() eq "Part-time"> selected</cfif>>Less than half-time</option>
							</cfselect>
						</div>
						<div class="clearfix">
							<label class="required">Degree Level</label>
							<cfselect name="Degree_Level" required="yes" message="Degree Level is required" onChange="validateDegreeLevel();" class="span3">
								<option value="Bachelors"<cfif scholarship.getDegree_Level() eq "Bachelors"> selected</cfif>>Bachelor's</option>
								<option value="Associates"<cfif scholarship.getDegree_Level() eq "Associates"> selected</cfif>>Associate's</option>
								<option value="Certificate"<cfif scholarship.getDegree_Level() eq "Certificate"> selected</cfif>>Certificate</option>
							</cfselect>
						</div>
						<div class="clearfix">
							<label class="required">Enrollment Date</label>
							<cfinput type="text" maxlength="10" name="Enrollment_Date" value="#DateFormat(scholarship.getEnrollment_Date(), 'm/d/yyyy')#" placeholder="m/d/yyyy" required="yes" validate="date" message="Enrollment Date is required and must be a valid date" class="span3">
						</div>
						<div class="clearfix">
							<label class="required">Primary College/University</label>
							<label class="checkbox">
								<cfinput type="checkbox" id="newInstitution" name="newInstitution" value="true" onClick="toggleInstitution();"> 
								My college/university is not listed
							</label>
							<div id="institutionContainer" style="margin-top: 10px;">
								<cfselect id="institutionSelect" name="Institution1_ID" required="yes" message="Primary College/University is required" class="span6">
									<option value="0" selected>Select...</option>
									<cfloop query="institutions">
										<option value="#Institution_ID#"<cfif scholarship.getInstitution1_ID() eq Institution_ID> selected</cfif>>#Display#</option>
									</cfloop>
								</cfselect>
							</div>
							<div id="institutionFormContainer" style="display: none; margin-top: 10px;">
								<div class="clearfix">
									<label class="required">College/University Name</label>
									<cfinput type="text" id="institution" name="Institution" value="" maxlength="200" class="span9">
								</div>
								<div class="clearfix">
									<label class="required">Financial Aid Office Address</label>
									<cfinput type="text" id="faoAddress1" name="FAO_Address1" value="" maxlength="200" class="span9">
								</div>
								<div class="clearfix">
									<label class="required">Financial Aid Office City</label>
									<cfinput type="text" id="faoCity" name="FAO_City" value="" maxlength="100" class="span9">
								</div>
								<div class="clearfix">
									<label class="required">Financial Aid Office Zip Code</label>
									<cfinput type="text" id="faoZipCode" name="FAO_Zip_Code" value="" validate="zipcode" maxlength="5" class="span9">
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="row-fluid">
					<div class="span12">
						<span class="pull-right">
							<cfinput type="submit" name="saveButton" class="btn btn-primary" value="Save" />
						</span>
					</div>
				</div>
			</div>


		</cfform> --->	

<cfelse>

	<div class="alert alert-info notFound">Scholarship not found</div>

</cfif> --->